package invariantChecking;

//start extract SynchronizedInvariantChecker
public class SynchronizedInvariantChecker {

    private static boolean invariantCheckInProgress = false;

    synchronized public static void checkInvariant( InvariantSupporter obj ) 
    {
	if ( invariantCheckInProgress )
	    return;
	invariantCheckInProgress = true;
	if ( !obj.invariant() )
	    throw new IllegalStateException("invariant failure");
	invariantCheckInProgress = false;
    }
}
//stop extract SynchronizedInvariantChecker
